package com.mengze.linlee_iot_adnroid.activity

import android.graphics.Color
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.MotionEvent
import android.view.View
import android.view.inputmethod.InputMethodManager
import androidx.lifecycle.ViewModelProvider
import com.mengze.linlee_iot_adnroid.R
import com.mengze.linlee_iot_adnroid.databinding.ActivityMainBinding
import com.mengze.linlee_iot_adnroid.databinding.ActivityPreLoadMachineBinding
import com.mengze.linlee_iot_adnroid.databinding.FragmentNotificationsBinding
import com.mengze.linlee_iot_adnroid.ui.notifications.NotificationsViewModel

class PreLoadMachineActivity : AppCompatActivity() {


    private lateinit var binding: ActivityPreLoadMachineBinding

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = ActivityPreLoadMachineBinding.inflate(layoutInflater)
        setContentView(binding.root)

        val activity = this
        // 方法1：直接设置颜色值
        activity?.window?.statusBarColor = Color.parseColor("#FF54D437") // 橙色
        activity?.window.apply {
            var statusBarColor = Color.parseColor("#FF54D437") // 设置颜色
        }
        binding.toolbarTitle.text = "预装机"
    }

    override fun dispatchTouchEvent(ev: MotionEvent): Boolean {
        currentFocus?.let {
            val imm = getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager
            imm.hideSoftInputFromWindow(it.windowToken, 0)
            it.clearFocus()
        }
        return super.dispatchTouchEvent(ev)
    }
}